<%--
  Created by IntelliJ IDEA.
  User: 丁广化
  Date: 2022/1/11
  Time: 17:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>菜品类别管理</title>
</head>
<script src="/js/jquery-3.1.1.min.js" type="text/javascript"></script>
<body>
<br/>
<jsp:include page="top.jsp"></jsp:include>
<hr/>

<table border="1px" style="width: 80%; margin: 0px auto">
    <tr>
        <td colspan="4" align="center">
            <input type="text" id="keyword" name="keyword" size="40"><input type="button" id="search" value="搜索">
        </td>
    </tr>
    <tr>
        <th>类别id</th>
        <th>类别名称</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
    </tr>
    <c:forEach items="${list}" var="lb">
        <tr>
            <td>${lb.id} </td>
            <td>${lb.cpname}</td>
            <td>
                <a href="/cplb/toUpdateLb.do?id=${lb.id}">修改</a>
            </td>
            <td>
                <a href="/cplb/delLb.do?id=${lb.id}" onclick="return delConfirm()">删除</a>
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="4" align="center">
            <a href="/cplbtj.jsp">添加新类别</a>
        </td>
    </tr>
</table>
<script>
    function delConfirm() {
        if (confirm("确认删除？")) {
            return true;
        } else {
            return false;
        }
    }

    $(function () {
        $(document).keyup(function () {
            $.ajax({
                type: 'post',
                url: '/cplb/searchLbmc.do',
                data: {
                    keyword: $("#keyword").val()
                },
                success: function (data) {
                    console.log("data====" + data);
                }
            });
        });
    });
</script>
</body>
</html>
